home *** CD-ROM | disk | FTP | other *** search
- Path: holly.ACNS.ColoState.EDU!not-for-mail
- From: corbyh@holly.ACNS.ColoState.EDU (Corby S. Hudnall)
- Newsgroups: comp.lang.c++
- Subject: Re: How can I include IOSTREAM.H only once?
- Date: 27 Feb 1996 21:25:09 -0700
- Organization: Colorado State University, Fort Collins, CO 80523
- Message-ID: <4h0lf5$bli@holly.ACNS.ColoState.EDU>
- References: <4gre90$oei@service.polymtl.ca> <4guild$r2i@nnrp1.news.primenet.com>
- NNTP-Posting-Host: holly.acns.colostate.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Brad Grossman (bjg@primenet.com) wrote:
- : Michael Gaudette <bluefox@info.polymtl.ca> wrote:
- : : I am presently engaged in what is usually called "the learning process",
- : : and I've been programming simple programs with classes. Because of this,
- : : I have had to #include <iostream.h> in most of my "class.cpp" files AND
- : : in my main program. This (added to conio.h and all the other standard
- : : libraries) usually result in a simple program being 20000 lines long.
- : : Is there any way (using Borland v4.5) to make the compiler only link
- : : those files ONCE?
-
- : : Thanks in advance for any help I may receive
-
- : I'm not all that experienced at C++ programming, but when looking through
- : the container classes that come with C++, I see the solution to your
- : problem. Try this where you need IOSTREAM.H:
-
- : #if !defined ( __IOSTREAM_H )
- : #include <iostream.h>
- : #endif
-
- The #ifndef preprocessing is done by the standard includes anyway. This is
- reinventing the wheel. Even though the program says it is 20000 lines,
- in actually, the appropriate code is only linked into the program once.
-
- // ------------ BEGIN SIGNATURE ---------------
- #include <iostream.h>
- void main()
- {
- cout<<"\aName:\tCorby S. Hudnall\n";
- cout<<"School:\tColorado State University\n";
- cout<<"EMail\tcorbyh@holly.colostate.edu\n";
- cout<<"URL\thttp://holly.colostate.edu/~corbyh/\n";
- }
- // ------------- END SIGNATURE ----------------
-